package com.ddwl.goods.dao.mapper;

import com.ddwl.common.dao.mapper.TkMapper;
import com.ddwl.goods.dao.model.AcademyCategory;
import com.ddwl.goods.dao.model.LimitTimePurGood;
import com.ddwl.schema.bo.goods.QueryLimitTimePurGoodBo;
import com.ddwl.schema.bo.order.OrderItemBo;
import com.ddwl.schema.vo.order.OrderSpuVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wenbin
 */
@Repository
public interface LimitTimePurGoodMapper extends TkMapper<LimitTimePurGood> {

    void updateOrderCount(@Param("list") List<OrderSpuVo> list);

    void downOrderCount(@Param("list") List<OrderSpuVo> list);

    void updateViewCount(@Param("itemId")String itemId, @Param("activeId")String activeId);

    /**
     * 商品重复校验
     * @retrun String
     * */
    @Select({"SELECT a.item_name FROM limit_time_pur_good a WHERE a.dflag = 0 AND a.is_effect = 1 GROUP BY a.item_name,a.barcode,a.limit_active_id HAVING COUNT(0) > 1 LIMIT 1"}) @ResultType(String.class)
    String checkItemRepeat();

    List<LimitTimePurGood> queryGood(@Param("param") QueryLimitTimePurGoodBo param);
}
